﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SerialPorts
{
    public class SerialPortException : Exception
    {
        public SerialPortException(string message)
            : base(message)
        {
        }

        public SerialPortException(Exception ex)
            : base(ex.Message, ex)
        {
        }

        public SerialPortException(string message, Exception ex)
            : base(message, ex)
        {
        }
    }

    public class NakSerialPortException : SerialPortException
    {
        public NakSerialPortException()
            : base("Negative acknowledge")
        {
        }
    }

    public class ReceivedInvalidPacketException : SerialPortException
    {
        public ReceivedInvalidPacketException()
            : base("Received data invalid.") 
        {
        }

        public ReceivedInvalidPacketException(string message)
            : base(message)
        {
        }
    }

    public class TimeoutSerialPortException : SerialPortException
    {
        public TimeoutSerialPortException(TimeoutException ex)
            : base(ex)
        {
        }
    }
}